unit Class_STAF;


interface
uses
  Classes,SysUtils,DB,FireDAC.Stan.Intf, FireDAC.Stan.Option,
  FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
  FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.MSSQL,
  FireDAC.Phys.MSSQLDef, FireDAC.Comp.Client, FireDAC.Stan.Param,
  FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, FireDAC.Comp.DataSet,
  FireDAC.VCLUI.Wait, FireDAC.Comp.UI;


type
  TSTAF=class(TObject)
  private
    FUNITLINK : string;
    FSTAFIDEX : Integer;
    FSTAFBDID : Integer;
    FSTAFKJND : Integer;
    FSTAFKJQJ : Integer;
    FKJNDKJQJ : Integer;
    FDEPTLINK : string;
    FSTAFSEX  : Integer;
    FSTAFTAX  : Integer;
    FSTAFCODE : string;
    FSTAFWORK : string;
    FSTAFNAME : string;
    FSTAFCARD : string;
    FSTAFCALL : string;
    FSTAFMOBL : string;
    FSTAFORDR : Integer;
    FSTATCODE : Integer;
    FSTAFADDR : string;
    FSTAFMEMO : string;
    FSTAFSEAT : TDateTime;
    FSTAFQUIT : TDateTime;
    FSTAFBANK : string;
    FSTAFNUMB : string;
    FSTAFPROF : string;
    FSTAFPOST : string;
    FSTAFSTOP : Integer;
    FSTOPGZJG : string;
    FSTAFBASEDIGIT: Integer;
    FSTAFPROPDIGIT: Integer;
    FRECTLINK : string;
    FSUBJLINK : string;
    FLOADIDENTITY: string;
  protected
  public
  public
  public
  public
    function GetObjtIdentity:string;
  published
    property UNITLINK : string read FUNITLINK  write FUNITLINK;
    property STAFIDEX : Integer read FSTAFIDEX  write FSTAFIDEX;
    property STAFBDID : Integer read FSTAFBDID  write FSTAFBDID;
    property STAFKJND : Integer read FSTAFKJND  write FSTAFKJND;
    property STAFKJQJ : Integer read FSTAFKJQJ  write FSTAFKJQJ;
    property KJNDKJQJ : Integer read FKJNDKJQJ  write FKJNDKJQJ;
    property DEPTLINK : string read FDEPTLINK  write FDEPTLINK;
    property STAFSEX  : Integer read FSTAFSEX   write FSTAFSEX;
    property STAFTAX  : Integer read FSTAFTAX   write FSTAFTAX;
    property STAFCODE : string read FSTAFCODE  write FSTAFCODE;
    property STAFWORK : string read FSTAFWORK  write FSTAFWORK;
    property STAFNAME : string read FSTAFNAME  write FSTAFNAME;
    property STAFCARD : string read FSTAFCARD  write FSTAFCARD;
    property STAFCALL : string read FSTAFCALL  write FSTAFCALL;
    property STAFMOBL : string read FSTAFMOBL  write FSTAFMOBL;
    property STAFORDR : Integer read FSTAFORDR  write FSTAFORDR;
    property STATCODE : Integer read FSTATCODE  write FSTATCODE;
    property STAFADDR : string read FSTAFADDR  write FSTAFADDR;
    property STAFMEMO : string read FSTAFMEMO  write FSTAFMEMO;
    property STAFSEAT : TDateTime read FSTAFSEAT  write FSTAFSEAT;
    property STAFQUIT : TDateTime read FSTAFQUIT  write FSTAFQUIT;
    property STAFBANK : string read FSTAFBANK  write FSTAFBANK;
    property STAFNUMB : string read FSTAFNUMB  write FSTAFNUMB;
    property STAFPROF : string read FSTAFPROF  write FSTAFPROF;
    property STAFPOST : string read FSTAFPOST  write FSTAFPOST;
    property STAFSTOP : Integer read FSTAFSTOP  write FSTAFSTOP;
    property STOPGZJG : string read FSTOPGZJG  write FSTOPGZJG;
    property STAFBASEDIGIT: Integer read FSTAFBASEDIGIT write FSTAFBASEDIGIT;
    property STAFPROPDIGIT: Integer read FSTAFPROPDIGIT write FSTAFPROPDIGIT;
    property RECTLINK : string read FRECTLINK  write FRECTLINK;
    property SUBJLINK : string read FSUBJLINK  write FSUBJLINK;
    property LOADIDENTITY: string read FLOADIDENTITY write FLOADIDENTITY;
  public
    class function  ReadDS(AUniQuery:TFDQuery):TSTAF;
  end;

implementation

{ TSTAF }
{procedure TSTAF.SetParameters;
begin
  inherited;
  with FUniSQL.Params do
  begin
    case FOptTyp of
      otAddx:
      begin
        ParamByName('UNIT_LINK').Value := UNITLINK;
        ParamByName('STAF_IDEX').Value := STAFIDEX;
        ParamByName('STAF_BDID').Value := STAFBDID;
        ParamByName('STAF_KJND').Value := STAFKJND;
        ParamByName('STAF_KJQJ').Value := STAFKJQJ;
        ParamByName('KJND_KJQJ').Value := KJNDKJQJ;
        ParamByName('DEPT_LINK').Value := DEPTLINK;
        ParamByName('STAF_SEX').Value := STAFSEX;
        ParamByName('STAF_TAX').Value := STAFTAX;
        ParamByName('STAF_CODE').Value := STAFCODE;
        ParamByName('STAF_WORK').Value := STAFWORK;
        ParamByName('STAF_NAME').Value := STAFNAME;
        ParamByName('STAF_CARD').Value := STAFCARD;
        ParamByName('STAF_CALL').Value := STAFCALL;
        ParamByName('STAF_MOBL').Value := STAFMOBL;
        ParamByName('STAF_ORDR').Value := STAFORDR;
        ParamByName('STAT_CODE').Value := STATCODE;
        ParamByName('STAF_ADDR').Value := STAFADDR;
        ParamByName('STAF_MEMO').Value := STAFMEMO;
        ParamByName('STAF_SEAT').Value := STAFSEAT;
        ParamByName('STAF_QUIT').Value := STAFQUIT;
        ParamByName('STAF_BANK').Value := STAFBANK;
        ParamByName('STAF_NUMB').Value := STAFNUMB;
        ParamByName('STAF_PROF').Value := STAFPROF;
        ParamByName('STAF_POST').Value := STAFPOST;
        ParamByName('STAF_STOP').Value := STAFSTOP;
        ParamByName('STOP_GZJG').Value := STOPGZJG;
        ParamByName('STAF_BASE_DIGIT').Value := STAFBASEDIGIT;
        ParamByName('STAF_PROP_DIGIT').Value := STAFPROPDIGIT;
        ParamByName('RECT_LINK').Value := RECTLINK;
        ParamByName('SUBJ_LINK').Value := SUBJLINK;
        ParamByName('LOAD_IDENTITY').Value := LOADIDENTITY;
      end;
      otEdit:
      begin
        ParamByName('UNIT_LINK').Value := UNITLINK;
        ParamByName('STAF_IDEX').Value := STAFIDEX;
        ParamByName('STAF_BDID').Value := STAFBDID;
        ParamByName('STAF_KJND').Value := STAFKJND;
        ParamByName('STAF_KJQJ').Value := STAFKJQJ;
        ParamByName('KJND_KJQJ').Value := KJNDKJQJ;
        ParamByName('DEPT_LINK').Value := DEPTLINK;
        ParamByName('STAF_SEX').Value := STAFSEX;
        ParamByName('STAF_TAX').Value := STAFTAX;
        ParamByName('STAF_CODE').Value := STAFCODE;
        ParamByName('STAF_WORK').Value := STAFWORK;
        ParamByName('STAF_NAME').Value := STAFNAME;
        ParamByName('STAF_CARD').Value := STAFCARD;
        ParamByName('STAF_CALL').Value := STAFCALL;
        ParamByName('STAF_MOBL').Value := STAFMOBL;
        ParamByName('STAF_ORDR').Value := STAFORDR;
        ParamByName('STAT_CODE').Value := STATCODE;
        ParamByName('STAF_ADDR').Value := STAFADDR;
        ParamByName('STAF_MEMO').Value := STAFMEMO;
        ParamByName('STAF_SEAT').Value := STAFSEAT;
        ParamByName('STAF_QUIT').Value := STAFQUIT;
        ParamByName('STAF_BANK').Value := STAFBANK;
        ParamByName('STAF_NUMB').Value := STAFNUMB;
        ParamByName('STAF_PROF').Value := STAFPROF;
        ParamByName('STAF_POST').Value := STAFPOST;
        ParamByName('STAF_STOP').Value := STAFSTOP;
        ParamByName('STOP_GZJG').Value := STOPGZJG;
        ParamByName('STAF_BASE_DIGIT').Value := STAFBASEDIGIT;
        ParamByName('STAF_PROP_DIGIT').Value := STAFPROPDIGIT;
        ParamByName('RECT_LINK').Value := RECTLINK;
        ParamByName('SUBJ_LINK').Value := SUBJLINK;
        ParamByName('LOAD_IDENTITY').Value := LOADIDENTITY;
      end;
      otDelt:
      begin
        ParamByName('UNIT_LINK').Value := UNITLINK;
        ParamByName('STAF_IDEX').Value := STAFIDEX;
        ParamByName('STAF_BDID').Value := STAFBDID;

      end;
    end;
  end;
end;

function TSTAF.CheckExist(AUniConnection: TUniConnection): Boolean;
begin
  Result:=CheckExist('TBL_STAF',['UNIT_LINK',UNITLINK,'STAF_IDEX',STAFIDEX,'STAF_BDID',STAFBDID],AUniConnection);
end;

function TSTAF.GetNextIdex: Integer;
begin

end;

function TSTAF.GetNextIdex(AUniConnection: TUniConnection): Integer;
begin

end;

function TSTAF.GetStrDelete: string;
begin
  Result:='DELETE FROM TBL_STAF WHERE   UNIT_LINK=:UNIT_LINK AND STAF_IDEX=:STAF_IDEX AND STAF_BDID=:STAF_BDID';
end;

function TSTAF.GetStrInsert: string;
begin
  Result:='INSERT INTO TBL_STAF'
         +'    ( UNIT_LINK, STAF_IDEX, STAF_BDID, STAF_KJND, STAF_KJQJ'
         +'    , KJND_KJQJ, DEPT_LINK, STAF_SEX, STAF_TAX, STAF_CODE'
         +'    , STAF_WORK, STAF_NAME, STAF_CARD, STAF_CALL, STAF_MOBL'
         +'    , STAF_ORDR, STAT_CODE, STAF_ADDR, STAF_MEMO, STAF_SEAT'
         +'    , STAF_QUIT, STAF_BANK, STAF_NUMB, STAF_PROF, STAF_POST'
         +'    , STAF_STOP, STOP_GZJG, STAF_BASE_DIGIT, STAF_PROP_DIGIT'
         +'    , RECT_LINK, SUBJ_LINK, LOAD_IDENTITY)'
         +'    VALUES'
         +'    (:UNIT_LINK,:STAF_IDEX,:STAF_BDID,:STAF_KJND,:STAF_KJQJ'
         +'    ,:KJND_KJQJ,:DEPT_LINK,:STAF_SEX,:STAF_TAX,:STAF_CODE'
         +'    ,:STAF_WORK,:STAF_NAME,:STAF_CARD,:STAF_CALL,:STAF_MOBL'
         +'    ,:STAF_ORDR,:STAT_CODE,:STAF_ADDR,:STAF_MEMO,:STAF_SEAT'
         +'    ,:STAF_QUIT,:STAF_BANK,:STAF_NUMB,:STAF_PROF,:STAF_POST'
         +'    ,:STAF_STOP,:STOP_GZJG,:STAF_BASE_DIGIT,:STAF_PROP_DIGIT'
         +'    ,:RECT_LINK,:SUBJ_LINK,:LOAD_IDENTITY)';
end;

function TSTAF.GetStrsIndex: string;
begin
  Result:=Format('%S-%D-%D',[UNITLINK,STAFIDEX,STAFBDID]);
end;

function TSTAF.GetStrUpdate: string;
begin
  Result:='UPDATE  TBL_STAF SET'
         +'    STAF_KJND=:STAF_KJND,'
         +'    STAF_KJQJ=:STAF_KJQJ,'
         +'    KJND_KJQJ=:KJND_KJQJ,'
         +'    DEPT_LINK=:DEPT_LINK,'
         +'    STAF_SEX=:STAF_SEX,'
         +'    STAF_TAX=:STAF_TAX,'
         +'    STAF_CODE=:STAF_CODE,'
         +'    STAF_WORK=:STAF_WORK,'
         +'    STAF_NAME=:STAF_NAME,'
         +'    STAF_CARD=:STAF_CARD,'
         +'    STAF_CALL=:STAF_CALL,'
         +'    STAF_MOBL=:STAF_MOBL,'
         +'    STAF_ORDR=:STAF_ORDR,'
         +'    STAT_CODE=:STAT_CODE,'
         +'    STAF_ADDR=:STAF_ADDR,'
         +'    STAF_MEMO=:STAF_MEMO,'
         +'    STAF_SEAT=:STAF_SEAT,'
         +'    STAF_QUIT=:STAF_QUIT,'
         +'    STAF_BANK=:STAF_BANK,'
         +'    STAF_NUMB=:STAF_NUMB,'
         +'    STAF_PROF=:STAF_PROF,'
         +'    STAF_POST=:STAF_POST,'
         +'    STAF_STOP=:STAF_STOP,'
         +'    STOP_GZJG=:STOP_GZJG,'
         +'    STAF_BASE_DIGIT=:STAF_BASE_DIGIT,'
         +'    STAF_PROP_DIGIT=:STAF_PROP_DIGIT,'
         +'    RECT_LINK=:RECT_LINK,'
         +'    SUBJ_LINK=:SUBJ_LINK,'
         +'    LOAD_IDENTITY=:LOAD_IDENTITY'
         +'    WHERE UNIT_LINK=:UNIT_LINK'
         +'    AND   STAF_IDEX=:STAF_IDEX'
         +'    AND   STAF_BDID=:STAF_BDID';
end;

constructor TSTAF.Create;
begin

end;

destructor TSTAF.Destroy;
begin

  inherited;
end;

class function TSTAF.ReadDS(AUniQuery: TUniQuery): TUniEngine;
var
  I:Integer;
  Field:TField;
  FieldName:string;
begin
  Result:=TSTAF.Create;

  with TSTAF(Result) do
  begin
    for I:=0 to AUniQuery.Fields.Count-1 do
    begin
      Field:=AUniQuery.Fields.Fields[I];
      FieldName:=Field.FieldName;
      if FieldName='UNIT_LINK' then
      begin
        UNITLINK :=Field.AsString;
      end else
      if FieldName='STAF_IDEX' then
      begin
        STAFIDEX :=Field.AsInteger;
      end else
      if FieldName='STAF_BDID' then
      begin
        STAFBDID :=Field.AsInteger;
      end else
      if FieldName='STAF_KJND' then
      begin
        STAFKJND :=Field.AsInteger;
      end else
      if FieldName='STAF_KJQJ' then
      begin
        STAFKJQJ :=Field.AsInteger;
      end else
      if FieldName='KJND_KJQJ' then
      begin
        KJNDKJQJ :=Field.AsInteger;
      end else
      if FieldName='DEPT_LINK' then
      begin
        DEPTLINK :=Field.AsString;
      end else
      if FieldName='STAF_SEX' then
      begin
        STAFSEX  :=Field.AsInteger;
      end else
      if FieldName='STAF_TAX' then
      begin
        STAFTAX  :=Field.AsInteger;
      end else
      if FieldName='STAF_CODE' then
      begin
        STAFCODE :=Field.AsString;
      end else
      if FieldName='STAF_WORK' then
      begin
        STAFWORK :=Field.AsString;
      end else
      if FieldName='STAF_NAME' then
      begin
        STAFNAME :=Field.AsString;
      end else
      if FieldName='STAF_CARD' then
      begin
        STAFCARD :=Field.AsString;
      end else
      if FieldName='STAF_CALL' then
      begin
        STAFCALL :=Field.AsString;
      end else
      if FieldName='STAF_MOBL' then
      begin
        STAFMOBL :=Field.AsString;
      end else
      if FieldName='STAF_ORDR' then
      begin
        STAFORDR :=Field.AsInteger;
      end else
      if FieldName='STAT_CODE' then
      begin
        STATCODE :=Field.AsInteger;
      end else
      if FieldName='STAF_ADDR' then
      begin
        STAFADDR :=Field.AsString;
      end else
      if FieldName='STAF_MEMO' then
      begin
        STAFMEMO :=Field.AsString;
      end else
      if FieldName='STAF_SEAT' then
      begin
        STAFSEAT :=Field.AsDateTime;
      end else
      if FieldName='STAF_QUIT' then
      begin
        STAFQUIT :=Field.AsDateTime;
      end else
      if FieldName='STAF_BANK' then
      begin
        STAFBANK :=Field.AsString;
      end else
      if FieldName='STAF_NUMB' then
      begin
        STAFNUMB :=Field.AsString;
      end else
      if FieldName='STAF_PROF' then
      begin
        STAFPROF :=Field.AsString;
      end else
      if FieldName='STAF_POST' then
      begin
        STAFPOST :=Field.AsString;
      end else
      if FieldName='STAF_STOP' then
      begin
        STAFSTOP :=Field.AsInteger;
      end else
      if FieldName='STOP_GZJG' then
      begin
        STOPGZJG :=Field.AsString;
      end else
      if FieldName='STAF_BASE_DIGIT' then
      begin
        STAFBASEDIGIT:=Field.AsInteger;
      end else
      if FieldName='STAF_PROP_DIGIT' then
      begin
        STAFPROPDIGIT:=Field.AsInteger;
      end else
      if FieldName='RECT_LINK' then
      begin
        RECTLINK :=Field.AsString;
      end else
      if FieldName='SUBJ_LINK' then
      begin
        SUBJLINK :=Field.AsString;
      end else
      if FieldName='LOAD_IDENTITY' then
      begin
        LOADIDENTITY:=Field.AsString;
      end;
    end
  end;
end;

class procedure TSTAF.ReadDS(AUniQuery: TUniQuery; var Result: TUniEngine);
var
  I:Integer;
  Field:TField;
begin
  if Result=nil then Exit;

  with TSTAF(Result) do
  begin
    for I:=0 to AUniQuery.Fields.Count-1 do
    begin
      Field:=AUniQuery.Fields.Fields[I];
      FieldName:=Field.FieldName;
      if FieldName='UNIT_LINK' then
      begin
        UNITLINK :=Field.AsString;
      end else
      if FieldName='STAF_IDEX' then
      begin
        STAFIDEX :=Field.AsInteger;
      end else
      if FieldName='STAF_BDID' then
      begin
        STAFBDID :=Field.AsInteger;
      end else
      if FieldName='STAF_KJND' then
      begin
        STAFKJND :=Field.AsInteger;
      end else
      if FieldName='STAF_KJQJ' then
      begin
        STAFKJQJ :=Field.AsInteger;
      end else
      if FieldName='KJND_KJQJ' then
      begin
        KJNDKJQJ :=Field.AsInteger;
      end else
      if FieldName='DEPT_LINK' then
      begin
        DEPTLINK :=Field.AsString;
      end else
      if FieldName='STAF_SEX' then
      begin
        STAFSEX  :=Field.AsInteger;
      end else
      if FieldName='STAF_TAX' then
      begin
        STAFTAX  :=Field.AsInteger;
      end else
      if FieldName='STAF_CODE' then
      begin
        STAFCODE :=Field.AsString;
      end else
      if FieldName='STAF_WORK' then
      begin
        STAFWORK :=Field.AsString;
      end else
      if FieldName='STAF_NAME' then
      begin
        STAFNAME :=Field.AsString;
      end else
      if FieldName='STAF_CARD' then
      begin
        STAFCARD :=Field.AsString;
      end else
      if FieldName='STAF_CALL' then
      begin
        STAFCALL :=Field.AsString;
      end else
      if FieldName='STAF_MOBL' then
      begin
        STAFMOBL :=Field.AsString;
      end else
      if FieldName='STAF_ORDR' then
      begin
        STAFORDR :=Field.AsInteger;
      end else
      if FieldName='STAT_CODE' then
      begin
        STATCODE :=Field.AsInteger;
      end else
      if FieldName='STAF_ADDR' then
      begin
        STAFADDR :=Field.AsString;
      end else
      if FieldName='STAF_MEMO' then
      begin
        STAFMEMO :=Field.AsString;
      end else
      if FieldName='STAF_SEAT' then
      begin
        STAFSEAT :=Field.AsDateTime;
      end else
      if FieldName='STAF_QUIT' then
      begin
        STAFQUIT :=Field.AsDateTime;
      end else
      if FieldName='STAF_BANK' then
      begin
        STAFBANK :=Field.AsString;
      end else
      if FieldName='STAF_NUMB' then
      begin
        STAFNUMB :=Field.AsString;
      end else
      if FieldName='STAF_PROF' then
      begin
        STAFPROF :=Field.AsString;
      end else
      if FieldName='STAF_POST' then
      begin
        STAFPOST :=Field.AsString;
      end else
      if FieldName='STAF_STOP' then
      begin
        STAFSTOP :=Field.AsInteger;
      end else
      if FieldName='STOP_GZJG' then
      begin
        STOPGZJG :=Field.AsString;
      end else
      if FieldName='STAF_BASE_DIGIT' then
      begin
        STAFBASEDIGIT:=Field.AsInteger;
      end else
      if FieldName='STAF_PROP_DIGIT' then
      begin
        STAFPROPDIGIT:=Field.AsInteger;
      end else
      if FieldName='RECT_LINK' then
      begin
        RECTLINK :=Field.AsString;
      end else
      if FieldName='SUBJ_LINK' then
      begin
        SUBJLINK :=Field.AsString;
      end else
      if FieldName='LOAD_IDENTITY' then
      begin
        LOADIDENTITY:=Field.AsString;
      end;
    end
  end;
end;

class function  TSTAF.CopyIt(ASTAF: TSTAF): TSTAF;
begin
  Result:=TSTAF.Create;
  TSTAF.CopyIt(ASTAF,Result)
end;

class procedure TSTAF.CopyIt(ASTAF:TSTAF;var Result:TSTAF);
begin
  if Result=nil then Exit;
  Result.UNITLINK :=ASTAF.UNITLINK;
  Result.STAFIDEX :=ASTAF.STAFIDEX;
  Result.STAFBDID :=ASTAF.STAFBDID;
  Result.STAFKJND :=ASTAF.STAFKJND;
  Result.STAFKJQJ :=ASTAF.STAFKJQJ;
  Result.KJNDKJQJ :=ASTAF.KJNDKJQJ;
  Result.DEPTLINK :=ASTAF.DEPTLINK;
  Result.STAFSEX  :=ASTAF.STAFSEX;
  Result.STAFTAX  :=ASTAF.STAFTAX;
  Result.STAFCODE :=ASTAF.STAFCODE;
  Result.STAFWORK :=ASTAF.STAFWORK;
  Result.STAFNAME :=ASTAF.STAFNAME;
  Result.STAFCARD :=ASTAF.STAFCARD;
  Result.STAFCALL :=ASTAF.STAFCALL;
  Result.STAFMOBL :=ASTAF.STAFMOBL;
  Result.STAFORDR :=ASTAF.STAFORDR;
  Result.STATCODE :=ASTAF.STATCODE;
  Result.STAFADDR :=ASTAF.STAFADDR;
  Result.STAFMEMO :=ASTAF.STAFMEMO;
  Result.STAFSEAT :=ASTAF.STAFSEAT;
  Result.STAFQUIT :=ASTAF.STAFQUIT;
  Result.STAFBANK :=ASTAF.STAFBANK;
  Result.STAFNUMB :=ASTAF.STAFNUMB;
  Result.STAFPROF :=ASTAF.STAFPROF;
  Result.STAFPOST :=ASTAF.STAFPOST;
  Result.STAFSTOP :=ASTAF.STAFSTOP;
  Result.STOPGZJG :=ASTAF.STOPGZJG;
  Result.STAFBASEDIGIT:=ASTAF.STAFBASEDIGIT;
  Result.STAFPROPDIGIT:=ASTAF.STAFPROPDIGIT;
  Result.RECTLINK :=ASTAF.RECTLINK;
  Result.SUBJLINK :=ASTAF.SUBJLINK;
  Result.LOADIDENTITY:=ASTAF.LOADIDENTITY;
end;}

{ TSTAF }

function TSTAF.GetObjtIdentity: string;
begin
  Result:=Format('%S-%S',[UNITLINK,STAFNAME]);
end;

class function TSTAF.ReadDS(AUniQuery: TFDQuery): TSTAF;
var
  I:Integer;
  Field:TField;
  FieldName:string;
begin
  Result:=TSTAF.Create;

  with TSTAF(Result) do
  begin
    for I:=0 to AUniQuery.Fields.Count-1 do
    begin
      Field:=AUniQuery.Fields.Fields[I];
      FieldName:=UpperCase(Field.FieldName);
      if FieldName='UNIT_LINK' then
      begin
        UNITLINK :=Field.AsString;
      end else
      if FieldName='STAF_IDEX' then
      begin
        STAFIDEX :=Field.AsInteger;
      end else
      if FieldName='STAF_BDID' then
      begin
        STAFBDID :=Field.AsInteger;
      end else
      if FieldName='STAF_KJND' then
      begin
        STAFKJND :=Field.AsInteger;
      end else
      if FieldName='STAF_KJQJ' then
      begin
        STAFKJQJ :=Field.AsInteger;
      end else
      if FieldName='KJND_KJQJ' then
      begin
        KJNDKJQJ :=Field.AsInteger;
      end else
      if FieldName='DEPT_LINK' then
      begin
        DEPTLINK :=Field.AsString;
      end else
      if FieldName='STAF_SEX' then
      begin
        STAFSEX  :=Field.AsInteger;
      end else
      if FieldName='STAF_TAX' then
      begin
        STAFTAX  :=Field.AsInteger;
      end else
      if FieldName='STAF_CODE' then
      begin
        STAFCODE :=Field.AsString;
      end else
      if FieldName='STAF_WORK' then
      begin
        STAFWORK :=Field.AsString;
      end else
      if FieldName='STAF_NAME' then
      begin
        STAFNAME :=Field.AsString;
      end else
      if FieldName='STAF_CARD' then
      begin
        STAFCARD :=Field.AsString;
      end else
      if FieldName='STAF_CALL' then
      begin
        STAFCALL :=Field.AsString;
      end else
      if FieldName='STAF_MOBL' then
      begin
        STAFMOBL :=Field.AsString;
      end else
      if FieldName='STAF_ORDR' then
      begin
        STAFORDR :=Field.AsInteger;
      end else
      if FieldName='STAT_CODE' then
      begin
        STATCODE :=Field.AsInteger;
      end else
      if FieldName='STAF_ADDR' then
      begin
        STAFADDR :=Field.AsString;
      end else
      if FieldName='STAF_MEMO' then
      begin
        STAFMEMO :=Field.AsString;
      end else
      if FieldName='STAF_SEAT' then
      begin
        STAFSEAT :=Field.AsDateTime;
      end else
      if FieldName='STAF_QUIT' then
      begin
        STAFQUIT :=Field.AsDateTime;
      end else
      if FieldName='STAF_BANK' then
      begin
        STAFBANK :=Field.AsString;
      end else
      if FieldName='STAF_NUMB' then
      begin
        STAFNUMB :=Field.AsString;
      end else
      if FieldName='STAF_PROF' then
      begin
        STAFPROF :=Field.AsString;
      end else
      if FieldName='STAF_POST' then
      begin
        STAFPOST :=Field.AsString;
      end else
      if FieldName='STAF_STOP' then
      begin
        STAFSTOP :=Field.AsInteger;
      end else
      if FieldName='STOP_GZJG' then
      begin
        STOPGZJG :=Field.AsString;
      end else
      if FieldName='STAF_BASE_DIGIT' then
      begin
        STAFBASEDIGIT:=Field.AsInteger;
      end else
      if FieldName='STAF_PROP_DIGIT' then
      begin
        STAFPROPDIGIT:=Field.AsInteger;
      end else
      if FieldName='RECT_LINK' then
      begin
        RECTLINK :=Field.AsString;
      end else
      if FieldName='SUBJ_LINK' then
      begin
        SUBJLINK :=Field.AsString;
      end else
      if FieldName='LOAD_IDENTITY' then
      begin
        LOADIDENTITY:=Field.AsString;
      end;
    end
  end;
end;

end.

